unit GetReportPeriodFormUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, rxToolEdit, rxPlacemnt;

type
  TGetReportPeriodForm = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    MakeReportButton: TButton;
    AbortButton: TButton;
    DateEditFrom: TDateEdit;
    DateEditTo: TDateEdit;
    FormStorage1: TFormStorage;
  private
    { Private declarations }
  public
    { Public declarations }
    procedure SetupForm(const aDateFrom,aDateTo: TDate);
  end;

var
  GetReportPeriodForm: TGetReportPeriodForm;

function GetReportPeriod(var aDateFrom, aDateTo: TDate): boolean;

implementation

{$R *.dfm}

function GetReportPeriod(var aDateFrom, aDateTo: TDate): boolean;
begin
  Result:= False;
  if (NOT Assigned(GetReportPeriodForm)) then begin
    GetReportPeriodForm:= TGetReportPeriodForm.Create(Application);
  end;
  GetReportPeriodForm.SetupForm(aDateFrom,aDateTo);

  if (GetReportPeriodForm.ShowModal = mrOK) then begin
    aDateFrom:= GetReportPeriodForm.DateEditFrom.Date;
    aDateTo:= GetReportPeriodForm.DateEditTo.Date;
    Result:= True;
  end;
  FreeAndNil(GetReportPeriodForm);
end;

procedure TGetReportPeriodForm.SetupForm(const aDateFrom,aDateTo: TDate);
begin
  DateEditFrom.Date:= aDateFrom;
  DateEditTo.Date:= aDateTo;
end;

end.
